﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using EZMemoLib;

using System.Data.Objects;
using System.Windows.Media.Animation;
using Microsoft.Windows.Controls;

namespace Remember.WPF.Views
{
    /// <summary>
    /// Interaction logic for MainPlayer.xaml
    /// </summary>
    public partial class MainPlayer : Window
    {

        DoubleAnimation animFadeIn = new DoubleAnimation();
        DoubleAnimation animFadeOut = new DoubleAnimation();
        public MainPlayer()
        {
            InitializeComponent();

            //var margin = btnAlmost.Margin;
            //btnStart.Margin = margin;
            //btnCheckAnswer.Margin = margin;

            animFadeIn = new DoubleAnimation();
            animFadeIn.From = 0;
            animFadeIn.To = 1;
            animFadeIn.Duration = new Duration(TimeSpan.FromMilliseconds(1600));
            this.BeginAnimation(OpacityProperty, animFadeIn);

            animFadeOut = new DoubleAnimation();
            animFadeOut.From = 1;
            animFadeOut.To = 0;
            animFadeOut.Duration = new Duration(TimeSpan.FromMilliseconds(500));

        }

        private void Window_KeyUp(object sender, KeyEventArgs e)
        {
            e.Handled = true;
            this.lblKeyInformation.Content = e.Key.ToString(); 

            switch (e.Key)
            {
                case Key.Escape:
                    break;

                case Key.Enter:
                    break;

                case Key.Right:

                    break;
                case Key.Left:

                    break;
                case Key.Down:

                    break;
                case Key.Up:
                    break;

                case Key.Space:

                    break;
                default:
                    break;

            }
        }

        private void btnStart_Click(object sender, RoutedEventArgs e)
        {
            var loginAdd = new LoginAdd();
            this.childWindow.Content = loginAdd;

            //this.childWindow.HorizontalAlignment = System.Windows.HorizontalAlignment.Center;
            //this.childWindow.VerticalAlignment = System.Windows.VerticalAlignment.Center;

            this.childWindow.WindowStartupLocation = Microsoft.Windows.Controls.WindowStartupLocation.Center;

            this.childWindow.Width = 360;
            this.childWindow.Height = 400;
            if (loginAdd.Height > 0)
            {
                this.childWindow.Height = loginAdd.Height + 40;
            }

            if (loginAdd.Width > 0)
            {
                this.childWindow.Width = loginAdd.Width;
            }
            this.childWindow.Show();

        }
    }
}
